import Router from 'koa-router';
import proxyService from '../../../common/proxyService';
import {
  getSpellGroupInfoH5A,
  getGroupBuyGoodsListH5A,
  getShareParamH5A,
  getUserInfoH5A,
  getSharePicH5,
  getUserSubscribeResultH5A,
  getRankStaisticH5A,
  updateSubscribeSceneH5A,
  saveInitiateAGroupH5A,
  saveJoinSpellGroupH5A,
  getSubscribeUrlH5A,
  getSpellGroupDetailH5A,
  saveFormStatisticH5A,
  brragelistH5A,
  getGroupRuleList,
  saveBargainFormStatisticH5,
  getOrderList,
} from '../../../api';

const router = new Router();

router.post('/saveFormStatisticH5', async ctx => {
  const response = await proxyService.postProxy(ctx, saveFormStatisticH5A);
  return (ctx.body = response);
});
router.post('/getGroupRuleListH5', async ctx => {
  const response = await proxyService.postProxy(ctx, getGroupRuleList);
  return (ctx.body = response);
});
router.post('/getGroupBuyGoodsList', async ctx => {
  const response = await proxyService.postProxy(ctx, getGroupBuyGoodsListH5A);
  // const response = await proxyService.mockData({
  //   code: 1,
  //   message: 'mock data success',
  //   data: [
  //     {
  //       sort: null,
  //       status: 1,
  //       id: 76,
  //       index: 1,
  //       joinGroupNum: 1,
  //       sgParticipantDtos: [
  //         {
  //           joinNum: 3,
  //           headImgUrl: '5165',
  //         },
  //       ],
  //     },
  //   ],
  // });
  return (ctx.body = response);
});
router.post('/getSharePicH5', async ctx => {
  const response = await proxyService.postProxy(ctx, getSharePicH5);
  return (ctx.body = response);
});
router.post('/getUserInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, getUserInfoH5A);
  return (ctx.body = response);
});
router.post('/brragelist', async ctx => {
  const response = await proxyService.postProxy(ctx, brragelistH5A);
  return (ctx.body = response);
});
router.post('/getSpellGroupDetail', async ctx => {
  const response = await proxyService.postProxy(ctx, getSpellGroupDetailH5A);
  return (ctx.body = response);
});
router.post('/getSpellGroupInfo', async ctx => {
  const response = await proxyService.postProxy(ctx, getSpellGroupInfoH5A);
  return (ctx.body = response);
});
//
router.post('/getShareParam', async ctx => {
  const response = await proxyService.postProxy(ctx, getShareParamH5A);
  return (ctx.body = response);
});
//
router.post('/getUserSubscribeResult', async ctx => {
  const response = await proxyService.postProxy(ctx, getUserSubscribeResultH5A);
  return (ctx.body = response);
});
//
router.post('/getRankStaistic', async ctx => {
  const response = await proxyService.postProxy(ctx, getRankStaisticH5A);
  return (ctx.body = response);
});
router.post('/updateSubscribeScene', async ctx => {
  const response = await proxyService.postProxy(ctx, updateSubscribeSceneH5A);
  return (ctx.body = response);
});
//
router.post('/saveInitiateAGroup', async ctx => {
  const response = await proxyService.postProxy(ctx, saveInitiateAGroupH5A);
  return (ctx.body = response);
});
//
router.post('/saveJoinSpellGroup', async ctx => {
  const response = await proxyService.postProxy(ctx, saveJoinSpellGroupH5A);
  return (ctx.body = response);
});

//
router.post('/getSubscribeUrl', async ctx => {
  const response = await proxyService.postProxy(ctx, getSubscribeUrlH5A);
  return (ctx.body = response);
});
//
router.post('/saveBargainFormStatisticH5', async ctx => {
  const response = await proxyService.postProxy(ctx, saveBargainFormStatisticH5);
  return (ctx.body = response);
});
//获取订单列表
router.post('/getOrderList', async ctx => {
  const response = await proxyService.postProxy(ctx, getOrderList);
  // console.log(ctx.requestParams)
  return (ctx.body = response);
});

export default router;
